package com.riant.bean;


import com.riant.annotation.MyConstraint;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @Classname User
 * @Description TODO
 * @Date 2022/4/30 22:51
 * @Created by 张斌
 */
public class User implements Serializable {
    @NotNull(message="id不能为空")
    private int id;
    @NotBlank(message="name不能为空")
    private String name;
    //@Size(min = 0,max = 2,message="长度应该在0和2位之间")
//    @Max(value = 99,message="age小于99")
//    @Min(value = 0,message="age大于0")
    @MyConstraint(min=0,max = 100,message = "age大于0且小于100")
    private int age;

    public User() {
    }

    public User(int id, String name, int age) {
        this.id = id;
        this.name = name;
        this.age = age;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
